package com.hl.web.fore;

import com.hl.pojo.PsychologicalKnowledge;
import com.hl.service.PsychologicalKnowledgeService;
import com.hl.util.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/psychologicalKnowledge")
public class PsychologicalKnowledgeController {
    @Autowired
    private PsychologicalKnowledgeService service;
    @PostMapping("/add")
    public ResultEntity add(@RequestBody PsychologicalKnowledge psychologicalKnowledge) {
        service.add(psychologicalKnowledge);
        return ResultEntity.ok();
    }

    @GetMapping("/findAll")
    public ResultEntity findAll() {
        return ResultEntity.ok(service.findAll());
    }

    @GetMapping("/del")
    public ResultEntity del(Integer id) {
        service.del(id);
        return ResultEntity.ok();
    }

    @GetMapping("/findById")
    public ResultEntity findById(Integer id) {
        return ResultEntity.ok(service.findById(id));
    }

    @PostMapping("/update")
    public ResultEntity update(@RequestBody PsychologicalKnowledge psychologicalKnowledge) {
        service.update(psychologicalKnowledge);
        return ResultEntity.ok();
    }
}
